import React, {useContext} from 'react';
import {Form, Input, Select, Button} from 'antd';
import WFC from '../context/OperatorContext';
const SetApprover = () => {
  const {currentNode, updateNode} = useContext(WFC);
  const handleChange = ({key, value}) => {
    currentNode[key] = value;
    updateNode();
  };
  return (
    <>
      <Form.Item label='节点名称'>
        <Input placeholder='请输入节点名称' value={currentNode?.nodeName} onChange={(e) =>  handleChange({key: 'nodeName', value: e.target.value})}/>
      </Form.Item>
      <Form.Item label='节点名称'>
        <Button type='link'>编辑处理人</Button>
      </Form.Item>
      <Form.Item label='审核人'>
        <Select
          placeholder='请选择审核人'
          value={currentNode?.rule}
          onChange={(value) => handleChange({key: 'owner', value})}
          options={[
            {
              label: '张三',
              value: '张三',
            },
            {
              label: '李四',
              value: '李四',
            },
          ]}
        />
      </Form.Item>
    </>
  );
};

export default SetApprover;
